@echo off
echo ===================================
echo  Architecture Check Tool
echo ===================================
echo.

REM 检查是否在build目录中
if not exist "test_logger.exe" (
    echo Error: test_logger.exe not found!
    echo Please run this script from the build directory after compilation.
    echo.
    pause
    exit /b 1
)

echo Checking executable architecture...
echo.

REM 使用dumpbin检查（如果可用）
where dumpbin >nul 2>&1
if %ERRORLEVEL% EQU 0 (
    echo Using dumpbin to check architecture:
    dumpbin /headers test_logger.exe | findstr "machine"
    echo.
)

REM 使用objdump检查（MinGW工具）
where objdump >nul 2>&1
if %ERRORLEVEL% EQU 0 (
    echo Using objdump to check architecture:
    objdump -f test_logger.exe | findstr "architecture"
    echo.
)

REM 使用file命令检查（如果可用）
where file >nul 2>&1
if %ERRORLEVEL% EQU 0 (
    echo Using file command to check architecture:
    file test_logger.exe
    echo.
)

REM 简单的文件大小检查（64位程序通常更大）
echo File size information:
dir test_logger.exe | findstr test_logger.exe
echo.

REM 尝试运行程序检查
echo Testing executable:
test_logger.exe --help 2>nul
if %ERRORLEVEL% EQU 0 (
    echo Program runs successfully!
) else (
    echo Program execution test (this is normal if no --help option exists)
)

echo.
echo Architecture check completed.
pause
